#include "common/common_include.h"
#include <stdlib.h>
#include <sstream>
#include <cmath>
#define PI 3.14159

bool assciate(string& aline, string& g_truth, string& out) {
	ifstream fin(g_truth);
	while (!fin.eof())
	fin.close();
}
int main(int argc, char ** argv){
	if (argc != 3) {
	    cout << "uages: ./associate result.txt groud_truth.txt\n";
	    return 1;
	}
	ifstream fin1(argv[1]);
	ifstream fin2(argv[2]);
	
	ofstream fout("ass.txt");
	while (!fin1.eof()) {
		string aline;
		getline(fin1, aline);
		istringstream iss(aline);
		long double time;
		iss >> time; iss >> time;
		while (!fin2.eof()) {
			string truth;
			getline(fin2, truth);
			istringstream iss2(truth);
			long double time2;
			iss2 >> time2;
			if (abs(time-time2) < 0.005) {
				fout << truth << endl;
				break;
			}
		}
	}
	
	return 0;
}
